<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>清除浮动</title>

    <style>
        .box {
            background-color: violet;
            /* overflow清除浮动 */
            overflow: hidden;
        }
        /* 伪元素清除浮动     */
        /* .box::after {
            clear: both;
            content: '';
            display: block;
            visibility: hidden;
        } */
        
        .box>div {
            width: 200px;
            height: 100px;
            float: left;
            background-color: black;
        }
    </style>

</head>

<body>


    <div class="box">
        <div></div>
        <!-- <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div> -->
    </div>


    <!-- <div style="width: 1000px;height: 100px;background-color: blue;">

    </div> -->

</body>

</html>